package cn.suimg.neo4j.repository;

import cn.suimg.neo4j.relationship.AttributeRelationship;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface AttributeRelationshipRepository extends Neo4jRepository<AttributeRelationship, Long> {

    @Query("match r = (tagGraph:标签 {tagId:{0}}) -[rel:属性] -> (songGraph:歌曲 {songId:{1}}) return distinct r")
    AttributeRelationship findByTagIdAndSongId(Integer tagId,Integer songId);


    @Query("match r = (languageGraph:语言 {name:{0}}) -[rel:属性] -> (songGraph:歌曲 {songId:{1}}) return distinct r")
    AttributeRelationship findByLanguageAndSongId(String language,Integer songId);
}
